(function(e,t){typeof exports==="object"&&typeof module!=="undefined"?module.exports=t(require("jquery"),require("./util.js")):typeof define==="function"&&define.amd?define(["jquery","./util.js"],t):(e=e||self,e.Modal=t(e.jQuery,e.Util))})(this,function(e,t){"use strict";e=e&&e.hasOwnProperty("default")?e["default"]:e;t=t&&t.hasOwnProperty("default")?t["default"]:t;function i(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||false;n.configurable=true;if("value"in n)n.writable=true;Object.defineProperty(e,n.key,n)}}function n(e,t,n){if(t)i(e.prototype,t);if(n)i(e,n);return e}function o(e,t,i){if(t in e){Object.defineProperty(e,t,{value:i,enumerable:true,configurable:true,writable:true})}else{e[t]=i}return e}function r(e){for(var t=1;t<arguments.length;t++){var i=arguments[t]!=null?arguments[t]:{};var n=Object.keys(i);if(typeof Object.getOwnPropertySymbols==="function"){n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))}n.forEach(function(t){o(e,t,i[t])})}return e}var s="modal";var a="4.3.1";var l="bs.modal";var d="."+l;var h=".data-api";var c=e.fn[s];var u=27;var f={backdrop:true,keyboard:true,focus:true,show:true};var _={backdrop:"(boolean|string)",keyboard:"boolean",focus:"boolean",show:"boolean"};var m={HIDE:"hide"+d,HIDDEN:"hidden"+d,SHOW:"show"+d,SHOWN:"shown"+d,FOCUSIN:"focusin"+d,RESIZE:"resize"+d,CLICK_DISMISS:"click.dismiss"+d,KEYDOWN_DISMISS:"keydown.dismiss"+d,MOUSEUP_DISMISS:"mouseup.dismiss"+d,MOUSEDOWN_DISMISS:"mousedown.dismiss"+d,CLICK_DATA_API:"click"+d+h};var g={SCROLLABLE:"modal-dialog-scrollable",SCROLLBAR_MEASURER:"modal-scrollbar-measure",BACKDROP:"modal-backdrop",OPEN:"modal-open",FADE:"fade",SHOW:"show"};var S={DIALOG:".modal-dialog",MODAL_BODY:".modal-body",DATA_TOGGLE:'[data-toggle="modal"]',DATA_DISMISS:'[data-dismiss="modal"]',FIXED_CONTENT:".fixed-top, .fixed-bottom, .is-fixed, .sticky-top",STICKY_CONTENT:".sticky-top"};var p=function(){function i(e,t){this._config=this._getConfig(t);this._element=e;this._dialog=e.querySelector(S.DIALOG);this._backdrop=null;this._isShown=false;this._isBodyOverflowing=false;this._ignoreBackdropClick=false;this._isTransitioning=false;this._scrollbarWidth=0}var o=i.prototype;o.toggle=function e(t){return this._isShown?this.hide():this.show(t)};o.show=function t(i){var n=this;if(this._isShown||this._isTransitioning){return}if(e(this._element).hasClass(g.FADE)){this._isTransitioning=true}var o=e.Event(m.SHOW,{relatedTarget:i});e(this._element).trigger(o);if(this._isShown||o.isDefaultPrevented()){return}this._isShown=true;this._checkScrollbar();this._setScrollbar();this._adjustDialog();this._setEscapeEvent();this._setResizeEvent();e(this._element).on(m.CLICK_DISMISS,S.DATA_DISMISS,function(e){return n.hide(e)});e(this._dialog).on(m.MOUSEDOWN_DISMISS,function(){e(n._element).one(m.MOUSEUP_DISMISS,function(t){if(e(t.target).is(n._element)){n._ignoreBackdropClick=true}})});this._showBackdrop(function(){return n._showElement(i)})};o.hide=function i(n){var o=this;if(n){n.preventDefault()}if(!this._isShown||this._isTransitioning){return}var r=e.Event(m.HIDE);e(this._element).trigger(r);if(!this._isShown||r.isDefaultPrevented()){return}this._isShown=false;var s=e(this._element).hasClass(g.FADE);if(s){this._isTransitioning=true}this._setEscapeEvent();this._setResizeEvent();e(document).off(m.FOCUSIN);e(this._element).removeClass(g.SHOW);e(this._element).off(m.CLICK_DISMISS);e(this._dialog).off(m.MOUSEDOWN_DISMISS);if(s){var a=t.getTransitionDurationFromElement(this._element);e(this._element).one(t.TRANSITION_END,function(e){return o._hideModal(e)}).emulateTransitionEnd(a)}else{this._hideModal()}};o.dispose=function t(){[window,this._element,this._dialog].forEach(function(t){return e(t).off(d)});e(document).off(m.FOCUSIN);e.removeData(this._element,l);this._config=null;this._element=null;this._dialog=null;this._backdrop=null;this._isShown=null;this._isBodyOverflowing=null;this._ignoreBackdropClick=null;this._isTransitioning=null;this._scrollbarWidth=null};o.handleUpdate=function e(){this._adjustDialog()};o._getConfig=function e(i){i=r({},f,i);t.typeCheckConfig(s,i,_);return i};o._showElement=function i(n){var o=this;var r=e(this._element).hasClass(g.FADE);if(!this._element.parentNode||this._element.parentNode.nodeType!==Node.ELEMENT_NODE){document.body.appendChild(this._element)}this._element.style.display="block";this._element.removeAttribute("aria-hidden");this._element.setAttribute("aria-modal",true);if(e(this._dialog).hasClass(g.SCROLLABLE)){this._dialog.querySelector(S.MODAL_BODY).scrollTop=0}else{this._element.scrollTop=0}if(r){t.reflow(this._element)}e(this._element).addClass(g.SHOW);if(this._config.focus){this._enforceFocus()}var s=e.Event(m.SHOWN,{relatedTarget:n});var a=function t(){if(o._config.focus){o._element.focus()}o._isTransitioning=false;e(o._element).trigger(s)};if(r){var l=t.getTransitionDurationFromElement(this._dialog);e(this._dialog).one(t.TRANSITION_END,a).emulateTransitionEnd(l)}else{a()}};o._enforceFocus=function t(){var i=this;e(document).off(m.FOCUSIN).on(m.FOCUSIN,function(t){if(document!==t.target&&i._element!==t.target&&e(i._element).has(t.target).length===0){i._element.focus()}})};o._setEscapeEvent=function t(){var i=this;if(this._isShown&&this._config.keyboard){e(this._element).on(m.KEYDOWN_DISMISS,function(e){if(e.which===u){e.preventDefault();i.hide()}})}else if(!this._isShown){e(this._element).off(m.KEYDOWN_DISMISS)}};o._setResizeEvent=function t(){var i=this;if(this._isShown){e(window).on(m.RESIZE,function(e){return i.handleUpdate(e)})}else{e(window).off(m.RESIZE)}};o._hideModal=function t(){var i=this;this._element.style.display="none";this._element.setAttribute("aria-hidden",true);this._element.removeAttribute("aria-modal");this._isTransitioning=false;this._showBackdrop(function(){e(document.body).removeClass(g.OPEN);i._resetAdjustments();i._resetScrollbar();e(i._element).trigger(m.HIDDEN)})};o._removeBackdrop=function t(){if(this._backdrop){e(this._backdrop).remove();this._backdrop=null}};o._showBackdrop=function i(n){var o=this;var r=e(this._element).hasClass(g.FADE)?g.FADE:"";if(this._isShown&&this._config.backdrop){this._backdrop=document.createElement("div");this._backdrop.className=g.BACKDROP;if(r){this._backdrop.classList.add(r)}e(this._backdrop).appendTo(document.body);e(this._element).on(m.CLICK_DISMISS,function(e){if(o._ignoreBackdropClick){o._ignoreBackdropClick=false;return}if(e.target!==e.currentTarget){return}if(o._config.backdrop==="static"){o._element.focus()}else{o.hide()}});if(r){t.reflow(this._backdrop)}e(this._backdrop).addClass(g.SHOW);if(!n){return}if(!r){n();return}var s=t.getTransitionDurationFromElement(this._backdrop);e(this._backdrop).one(t.TRANSITION_END,n).emulateTransitionEnd(s)}else if(!this._isShown&&this._backdrop){e(this._backdrop).removeClass(g.SHOW);var a=function e(){o._removeBackdrop();if(n){n()}};if(e(this._element).hasClass(g.FADE)){var l=t.getTransitionDurationFromElement(this._backdrop);e(this._backdrop).one(t.TRANSITION_END,a).emulateTransitionEnd(l)}else{a()}}else if(n){n()}};o._adjustDialog=function e(){var t=this._element.scrollHeight>document.documentElement.clientHeight;if(!this._isBodyOverflowing&&t){this._element.style.paddingLeft=this._scrollbarWidth+"px"}if(this._isBodyOverflowing&&!t){this._element.style.paddingRight=this._scrollbarWidth+"px"}};o._resetAdjustments=function e(){this._element.style.paddingLeft="";this._element.style.paddingRight=""};o._checkScrollbar=function e(){var t=document.body.getBoundingClientRect();this._isBodyOverflowing=t.left+t.right<window.innerWidth;this._scrollbarWidth=this._getScrollbarWidth()};o._setScrollbar=function t(){var i=this;if(this._isBodyOverflowing){var n=[].slice.call(document.querySelectorAll(S.FIXED_CONTENT));var o=[].slice.call(document.querySelectorAll(S.STICKY_CONTENT));e(n).each(function(t,n){var o=n.style.paddingRight;var r=e(n).css("padding-right");e(n).data("padding-right",o).css("padding-right",parseFloat(r)+i._scrollbarWidth+"px")});e(o).each(function(t,n){var o=n.style.marginRight;var r=e(n).css("margin-right");e(n).data("margin-right",o).css("margin-right",parseFloat(r)-i._scrollbarWidth+"px")});var r=document.body.style.paddingRight;var s=e(document.body).css("padding-right");e(document.body).data("padding-right",r).css("padding-right",parseFloat(s)+this._scrollbarWidth+"px")}e(document.body).addClass(g.OPEN)};o._resetScrollbar=function t(){var i=[].slice.call(document.querySelectorAll(S.FIXED_CONTENT));e(i).each(function(t,i){var n=e(i).data("padding-right");e(i).removeData("padding-right");i.style.paddingRight=n?n:""});var n=[].slice.call(document.querySelectorAll(""+S.STICKY_CONTENT));e(n).each(function(t,i){var n=e(i).data("margin-right");if(typeof n!=="undefined"){e(i).css("margin-right",n).removeData("margin-right")}});var o=e(document.body).data("padding-right");e(document.body).removeData("padding-right");document.body.style.paddingRight=o?o:""};o._getScrollbarWidth=function e(){var t=document.createElement("div");t.className=g.SCROLLBAR_MEASURER;document.body.appendChild(t);var i=t.getBoundingClientRect().width-t.clientWidth;document.body.removeChild(t);return i};i._jQueryInterface=function t(n,o){return this.each(function(){var t=e(this).data(l);var s=r({},f,e(this).data(),typeof n==="object"&&n?n:{});if(!t){t=new i(this,s);e(this).data(l,t)}if(typeof n==="string"){if(typeof t[n]==="undefined"){throw new TypeError('No method named "'+n+'"')}t[n](o)}else if(s.show){t.show(o)}})};n(i,null,[{key:"VERSION",get:function e(){return a}},{key:"Default",get:function e(){return f}}]);return i}();e(document).on(m.CLICK_DATA_API,S.DATA_TOGGLE,function(i){var n=this;var o;var s=t.getSelectorFromElement(this);if(s){o=document.querySelector(s)}var a=e(o).data(l)?"toggle":r({},e(o).data(),e(this).data());if(this.tagName==="A"||this.tagName==="AREA"){i.preventDefault()}var d=e(o).one(m.SHOW,function(t){if(t.isDefaultPrevented()){return}d.one(m.HIDDEN,function(){if(e(n).is(":visible")){n.focus()}})});p._jQueryInterface.call(e(o),a,this)});e.fn[s]=p._jQueryInterface;e.fn[s].Constructor=p;e.fn[s].noConflict=function(){e.fn[s]=c;return p._jQueryInterface};return p});
//# sourceMappingURL=modal.map.js